//
//  AdaptCellHeight.m
//  CapriceMusic
//
//  Created by 蒋恩浩 on 16/1/8.
//  Copyright © 2016年 MYX. All rights reserved.
//

#import "AdaptCellHeight.h"

@implementation AdaptCellHeight

+ (CGFloat)getHeightwithFont:(NSInteger)fontSize withText:(NSString *)text withWidth:(CGFloat)width {
    
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]};
    //    通过字典计算高度和宽度
    CGRect rect = [text boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size.height;
}

@end
